// import Taro from '@tarojs/taro';
import { userInfo } from '../../../utils/api';

export default {
  namespace: 'user',
  state: {
    user: [],
  },

  effects: {
    * getUser({ payload }, { call, put }) {
      const result = yield call(userInfo, {
        ...payload
      })
      yield put({
        type: 'updateState',
        payload: {
          user: result
        }
      })
    }
  },

  reducers: {
    updateState(state, { payload: user }) {
      return { ...state, ...user }
    }
  }

}
